/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import Domain.Laminaat;
import Domain.Materiaal;
import java.util.ArrayList;
import javax.swing.JPanel;

/**
 *
 * @author Memet
 */
public class LayupLaminate extends javax.swing.JFrame {

    /**
     * Creates new form LayupLaminate
     */
    public LayupLaminate() {
        initComponents();
        checkHoek.setSelected(true);
        checkDikte7.setSelected(true);
        checkNaam7.setSelected(false);
        checkNummer.setSelected(true);
        ArrayList<Materiaal> mats = new ArrayList<Materiaal>();
        
       
    }

    public void setLaminate(Laminaat lam)
    {
//        jScrollPane1.setViewportView(new Draw.LamelPanel(lam, Global.data, this));
        ArrayList<Materiaal> mats = new ArrayList<Materiaal>();


            for (int i = 0; i < lam.getLam().getRowDimension(); i++) {
                Materiaal m = null;//Global.data.getMateriaal((int)lam.getLam().get(i,1));

                if(!mats.contains(m)) 
                {
                    mats.add(m);
                }
            }
            for(Materiaal mat : mats)
            {
//                LegendaItemPane item = new LegendaItemPane();
//                item.setMateriaal(mat);
//                tbLegenda.add(item);
            }
            tbLegenda.revalidate();
            this.repaint();
//        LegendaForm frm = new LegendaForm(lam, Global.data);
//        setLegenda(frm);
    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane2 = new javax.swing.JScrollPane();
        tbLegenda = new javax.swing.JToolBar();
        jPanel8 = new javax.swing.JPanel();
        checkHoek = new javax.swing.JCheckBox();
        checkDikte7 = new javax.swing.JCheckBox();
        checkNaam7 = new javax.swing.JCheckBox();
        checkNummer = new javax.swing.JCheckBox();
        jScrollPane1 = new javax.swing.JScrollPane();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        addWindowListener(new java.awt.event.WindowAdapter() {
            public void windowClosing(java.awt.event.WindowEvent evt) {
                formWindowClosing(evt);
            }
        });

        tbLegenda.setFloatable(false);
        tbLegenda.setOrientation(javax.swing.SwingConstants.VERTICAL);
        tbLegenda.setRollover(true);
        jScrollPane2.setViewportView(tbLegenda);

        checkHoek.setText("Angle");
        checkHoek.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkHoekActionPerformed(evt);
            }
        });

        checkDikte7.setText("Thickness");
        checkDikte7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkDikte7ActionPerformed(evt);
            }
        });

        checkNaam7.setText("Name");
        checkNaam7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkNaam7ActionPerformed(evt);
            }
        });

        checkNummer.setText("Number");
        checkNummer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                checkNummerActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addGap(39, 39, 39)
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(checkNummer)
                    .addComponent(checkNaam7)
                    .addComponent(checkDikte7)
                    .addComponent(checkHoek))
                .addContainerGap(62, Short.MAX_VALUE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(checkHoek)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkDikte7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkNaam7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(checkNummer)
                .addContainerGap(175, Short.MAX_VALUE))
        );

        jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane1.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane2))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 457, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 426, Short.MAX_VALUE)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel8, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 146, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void checkHoekActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkHoekActionPerformed

   }//GEN-LAST:event_checkHoekActionPerformed

    private void checkDikte7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkDikte7ActionPerformed

   }//GEN-LAST:event_checkDikte7ActionPerformed

    private void checkNaam7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkNaam7ActionPerformed

   }//GEN-LAST:event_checkNaam7ActionPerformed

    private void checkNummerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_checkNummerActionPerformed

   }//GEN-LAST:event_checkNummerActionPerformed

    private void formWindowClosing(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowClosing
        closeActions();
    }//GEN-LAST:event_formWindowClosing

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox checkDikte7;
    private javax.swing.JCheckBox checkHoek;
    private javax.swing.JCheckBox checkNaam7;
    private javax.swing.JCheckBox checkNummer;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JToolBar tbLegenda;
    // End of variables declaration//GEN-END:variables

public boolean hoek()
    {
        return checkHoek.isSelected();
    }

    public boolean dikte()
    {
        return checkDikte7.isSelected();
    }

    public boolean naam()
    {
        return checkNaam7.isSelected();
    }

    public boolean nummer() {
        return checkNummer.isSelected();
    }

    public void setLegenda(JPanel p)
    {
        jScrollPane2.setViewportView(p);
    }

    public void closeActions()
    {
//        Global.layupForm = null;
//        Global.laminatesForm.BtnLayup(true);
//        Global.mainForm.closeFrame(this);
        this.dispose();
    }
}
